import Vue from 'vue'
import Router from 'vue-router'
import Home from '@/components/Home'
import L from '@/components/List'
import N from '@/components/News'
import A from '@/components/About'
import D from '@/components/Detail'
import B from '@/components/Books'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'Home',
      component: Home
    },
    {
      path: '/list', //页面中url中显示的地址信息
      name: 'List',  //路由名字，可以随便写，但是不能重名
      component: L , //组件的名字
      children:[{    //子路由
        name:'Books',
        path:'books/:type',  // 表示传递的参数params
        component:B
      }]
    },
    {
      path: '/news',
      name: 'News',
      component: N
    },
    {
      path: '/about',
      name: 'About',
      component: A
    },
    {
      path: '/detail',
      name: 'Detail',
      component: D
    },
  ]
})
